Skip to content

Preview the cutting plan with costs before generating the PDF - #48

Open
Maaxion wants to merge 2 commits into
BenchUp3D:mainfrom
Maaxion:cutlist-preview
Open

Maaxion wants to merge 2 commits into
BenchUp3D:mainfrom
Maaxion:cutlist-preview

Conversation

@Maaxion

@Maaxion Maaxion commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

One-line description

Show the cutting plan and its sheet costs in the cutting plan dialog, before the PDF is generated.

Stacked on #47. Only the second commit is new here; the first is #47 and drops out of this diff once that is merged.

Changes in detail

  • The cutting plan dialog is wider and shows a preview below the existing settings. Per material: a heading, the cut table, the sheet drawings with the grain legend and dashed joinery lines, and the cuts that do not fit the stock.
  • The preview follows the dialog's settings, including "Respect wood grain direction" and "Show wood joinery", and updates as they change.
  • On desktop the layout is calculated on a background thread, one at a time, and the last layout stays visible meanwhile. The web build calculates it inline.
  • The layout is cached on the document revision, the selection and the layout settings, so nothing is repacked or compared per frame.
  • New "Costs" table: unit price, whole-sheet cost per material and a total. "Show used-area cost" adds a column that prices only the area cut from each sheet. That option is saved next to the cutting plan scope, not in the layout settings, and toggling it does not repack.
  • New CuttingPlan::view() returns the plan as data (material sections, cut rows, sheets, oversized cuts, net area). The preview and the time estimates use it. This is also the data an agent tool for the cutting plan would need (Next tools for agents (CLI and MCP) #42).
  • The PDF output is unchanged. The PDF and the preview share two small helpers for the grain legend and the joinery offset.
  • The three price lookups in time_estimates.rs now call one Settings::wood_price() with the same rule as before.
  • Text keys added to en, pt_BR and zh_CN.

Testing

  • New cutting_view_tests.rs: cost totals, a price of 0, stock missing from the catalog, stock without area, cache invalidation on revision, scope, selection and settings, and a late layout for an older key not replacing the current one.
  • New test in cutting_plan_tests.rs that the view agrees with the PDF and the estimates. The existing grain and joinery tests pass unchanged.
  • The used-area option added to the preference regression list in sidebar.rs.
  • Ran the benchup-app library tests on this commit: the branch adds no failures compared with main.
  • cargo check for wasm32-unknown-unknown is free of warnings.
  • Tested by hand in the desktop app.

Try several piece orders and split rules and keep the layout with the fewest sheets. Add a layout strategy setting (fewest sheets, rip first, largest offcut) and an edge trim margin for sheet goods, both in the cut dialog and saved with the other layout settings.
Show the cut tables, sheet layouts with grain and joinery, oversized cuts and sheet costs in the cutting plan dialog. The preview and the time estimates share one layout view.
@dannycoulombe

Copy link
Copy Markdown
Collaborator

I see what you're trying to achieve with this change, and I agree with the vision.

Since generating the PDF isn't computationally expensive, perhaps we could use a two-column layout, with the settings on the left and an embedded PDF preview on the right that updates automatically as settings change.

This would allow users to see the results in real time while avoiding the need to maintain a separate layer of code that essentially duplicates what the PDF already does.

@Maaxion

Maaxion commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for taking a look!

I agree the cutting plan UI/UX needs more work, and a two-column layout with live-updating results sounds like a good direction. I'd prefer to get there in smaller steps though, rather than one very large change, so I'd keep this PR scoped as it is and do the layout rework as a separate follow-up PR.

On using the PDF as the preview: I don't think the PDF should be the main presentation layer. PDFs are awkward to work with inside an app: hard to make interactive, hard to style and limited in how they can respond to the rest of the UI. I see the PDF as a separate export, something you print and keep on hand in the workshop, while the in-app preview is its own thing. That does mean two rendering paths, but with LLM-assisted development, maintaining both is not much of a burden.

Beyond the UI, the material stock and cut list are currently very sheet-goods oriented. They need to support dimensional lumber as well. Right now the feature doesn't really work if you use BenchUp to design something like a shed. I think that's a bigger gap than the layout, and another reason to keep the changes incremental.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants